function out = xenopus
out{1} = @init;
out{2} = @fun_eval;
out{3} = @jacobian;
out{4} = @jacobianp;
out{5} = @hessians;
out{6} = @hessiansp;
out{7} = @der3;
out{8} = [];
out{9} = [];

% --------------------------------------------------------------------------
function dydt = fun_eval(t,kmrgd,Cabas, T)
Cm=1;
gCaHH=2600;
gNaHH=780;
gKHH=2400;
gL=9.98;
gKCa=18;
VCa=100;
VNa=60;
VK=-75;
VL=-50.95;
Vprime=50;
Vn=30;
Vp=60;
Vq=55;
r=8.9;
f=0.064;
F=9.65;
kCa=6.2;
u0=0.01;
uc=0.003;
V0=-52;
P0=0.251;
Cai0=0.13;
alpham=exp(log(3)*((T-6.3)/10.0))*20*(25-kmrgd(1)-Vprime)/(exp((25-kmrgd(1)-Vprime)/10)-1.0);
betam=exp(log(3)*((T-6.3)/10.0))*800*exp((-kmrgd(1)-Vprime)/18);
alphah=exp(log(3)*((T-6.3)/10.0))*14*exp((-kmrgd(1)-Vprime)/20);
betah=exp(log(3)*((T-6.3)/10.0))*200/(1+exp((30-kmrgd(1)-Vprime)/10));
alphap=exp(log(3)*((T-6.3)/10.0))*20*(25-kmrgd(1)-Vp)/(exp((25-kmrgd(1)-Vp)/10)-1.0);
betap=exp(log(3)*((T-6.3)/10.0))*800*exp((-kmrgd(1)-Vp)/18);
alphaq=exp(log(3)*((T-6.3)/10.0))*14*exp((-kmrgd(1)-Vq)/20);
betaq=exp(log(3)*((T-6.3)/10.0))*200/(1+exp((30-kmrgd(1)-Vq)/10));
alphan=exp(log(3)*((T-6.3)/10.0))*2*(10-kmrgd(1)-Vn)/(exp((10-kmrgd(1)-Vn)/10)-1.0);
betan=exp(log(3)*((T-6.3)/10.0))*25*exp((-kmrgd(1)-Vn)/80);
Palpha=u0*(kmrgd(8)-Cabas);
Pbeta=uc;
ICaHH=gCaHH*kmrgd(2)*kmrgd(2)*kmrgd(2)*kmrgd(3)*(kmrgd(1)-VCa);
INaHH=gNaHH*kmrgd(4)*kmrgd(4)*kmrgd(4)*kmrgd(5)*(kmrgd(1)-VNa);
IKHH=gKHH*kmrgd(6)*kmrgd(6)*kmrgd(6)*kmrgd(6)*(kmrgd(1)-VK);
IL=gL*(kmrgd(1)-VL);
IKCa=gKCa*kmrgd(7)*(kmrgd(1)-VK);
dydt=[-(ICaHH+INaHH+IKHH+IL+IKCa)/Cm;
alpham*(1-kmrgd(2))-betam*kmrgd(2);
alphah*(1-kmrgd(3))-betah*kmrgd(3);
alphap*(1-kmrgd(4))-betap*kmrgd(4);
alphaq*(1-kmrgd(5))-betaq*kmrgd(5);
alphan*(1-kmrgd(6))-betan*kmrgd(6);
Palpha*(1-kmrgd(7))-Pbeta*kmrgd(7);
f*(-3*ICaHH/(2*r*F)-kCa*(kmrgd(8)-Cabas));];

% --------------------------------------------------------------------------
function [tspan,y0,options] = init
handles = feval(xenopus);
y0=[0,0,0,0,0,0,0,0];
options = odeset('Jacobian',handles(3),'JacobianP',handles(4),'Hessians',handles(5),'HessiansP',handles(6));
tspan = [0 10];

% --------------------------------------------------------------------------
function jac = jacobian(t,kmrgd,Cabas, T)
jac=[[-2600*kmrgd(2)^3*kmrgd(3)-780*kmrgd(4)^3*kmrgd(5)-2400*kmrgd(6)^4-499/50-18*kmrgd(7),-7800*kmrgd(2)^2*kmrgd(3)*(kmrgd(1)-100),-2600*kmrgd(2)^3*(kmrgd(1)-100),-2340*kmrgd(4)^2*kmrgd(5)*(kmrgd(1)-60),-780*kmrgd(4)^3*(kmrgd(1)-60),-9600*kmrgd(6)^3*(kmrgd(1)+75),-18*kmrgd(1)-1350,0];[-20*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(exp(-5/2-1/10*kmrgd(1))-1)*(1-kmrgd(2))+2*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*(-25-kmrgd(1))/(exp(-5/2-1/10*kmrgd(1))-1)^2*(1-kmrgd(2))*exp(-5/2-1/10*kmrgd(1))+400/9*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/18*kmrgd(1)-25/9)*kmrgd(2),-20*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*(-25-kmrgd(1))/(exp(-5/2-1/10*kmrgd(1))-1)-800*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/18*kmrgd(1)-25/9),0,0,0,0,0,0];[-7/10*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/20*kmrgd(1)-5/2)*(1-kmrgd(3))-20*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(1+exp(-2-1/10*kmrgd(1)))^2*kmrgd(3)*exp(-2-1/10*kmrgd(1)),0,-14*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/20*kmrgd(1)-5/2)-200*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(1+exp(-2-1/10*kmrgd(1))),0,0,0,0,0];[-20*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(exp(-7/2-1/10*kmrgd(1))-1)*(1-kmrgd(4))+2*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*(-35-kmrgd(1))/(exp(-7/2-1/10*kmrgd(1))-1)^2*(1-kmrgd(4))*exp(-7/2-1/10*kmrgd(1))+400/9*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/18*kmrgd(1)-10/3)*kmrgd(4),0,0,-20*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*(-35-kmrgd(1))/(exp(-7/2-1/10*kmrgd(1))-1)-800*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/18*kmrgd(1)-10/3),0,0,0,0];[-7/10*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/20*kmrgd(1)-11/4)*(1-kmrgd(5))-20*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(1+exp(-5/2-1/10*kmrgd(1)))^2*kmrgd(5)*exp(-5/2-1/10*kmrgd(1)),0,0,0,-14*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/20*kmrgd(1)-11/4)-200*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(1+exp(-5/2-1/10*kmrgd(1))),0,0,0];[-2*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(exp(-2-1/10*kmrgd(1))-1)*(1-kmrgd(6))+1/5*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*(-20-kmrgd(1))/(exp(-2-1/10*kmrgd(1))-1)^2*(1-kmrgd(6))*exp(-2-1/10*kmrgd(1))+5/16*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/80*kmrgd(1)-3/8)*kmrgd(6),0,0,0,0,-2*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*(-20-kmrgd(1))/(exp(-2-1/10*kmrgd(1))-1)-25*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/80*kmrgd(1)-3/8),0,0];[0,0,0,0,0,0,-1/100*kmrgd(8)+1/100*Cabas-3/1000,1/100-1/100*kmrgd(7)];[-49920/17177*kmrgd(2)^3*kmrgd(3),-149760/17177*kmrgd(2)^2*kmrgd(3)*(kmrgd(1)-100),-49920/17177*kmrgd(2)^3*(kmrgd(1)-100),0,0,0,0,-248/625]];
% --------------------------------------------------------------------------
function jacp = jacobianp(t,kmrgd,Cabas, T)
jacp=[[0,0];[0,2473854946935173/1125899906842624*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*(-25-kmrgd(1))/(exp(-5/2-1/10*kmrgd(1))-1)*(1-kmrgd(2))-12369274734675865/140737488355328*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/18*kmrgd(1)-25/9)*kmrgd(2)];[0,17316984628546211/11258999068426240*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/20*kmrgd(1)-5/2)*(1-kmrgd(3))-12369274734675865/562949953421312*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(1+exp(-2-1/10*kmrgd(1)))*kmrgd(3)];[0,2473854946935173/1125899906842624*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*(-35-kmrgd(1))/(exp(-7/2-1/10*kmrgd(1))-1)*(1-kmrgd(4))-12369274734675865/140737488355328*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/18*kmrgd(1)-10/3)*kmrgd(4)];[0,17316984628546211/11258999068426240*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/20*kmrgd(1)-11/4)*(1-kmrgd(5))-12369274734675865/562949953421312*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(1+exp(-5/2-1/10*kmrgd(1)))*kmrgd(5)];[0,2473854946935173/11258999068426240*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*(-20-kmrgd(1))/(exp(-2-1/10*kmrgd(1))-1)*(1-kmrgd(6))-12369274734675865/4503599627370496*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/80*kmrgd(1)-3/8)*kmrgd(6)];[-1/100+1/100*kmrgd(7),0];[248/625,0]];
% --------------------------------------------------------------------------
function hess = hessians(t,kmrgd,Cabas, T)
hess1=[[0,-7800*kmrgd(2)^2*kmrgd(3),-2600*kmrgd(2)^3,-2340*kmrgd(4)^2*kmrgd(5),-780*kmrgd(4)^3,-9600*kmrgd(6)^3,-18,0];[-4*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(exp(-5/2-1/10*kmrgd(1))-1)^2*(1-kmrgd(2))*exp(-5/2-1/10*kmrgd(1))+2/5*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*(-25-kmrgd(1))/(exp(-5/2-1/10*kmrgd(1))-1)^3*(1-kmrgd(2))*exp(-5/2-1/10*kmrgd(1))^2-1/5*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*(-25-kmrgd(1))/(exp(-5/2-1/10*kmrgd(1))-1)^2*(1-kmrgd(2))*exp(-5/2-1/10*kmrgd(1))-200/81*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/18*kmrgd(1)-25/9)*kmrgd(2),20*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(exp(-5/2-1/10*kmrgd(1))-1)-2*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*(-25-kmrgd(1))/(exp(-5/2-1/10*kmrgd(1))-1)^2*exp(-5/2-1/10*kmrgd(1))+400/9*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/18*kmrgd(1)-25/9),0,0,0,0,0,0];[7/200*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/20*kmrgd(1)-5/2)*(1-kmrgd(3))-4*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(1+exp(-2-1/10*kmrgd(1)))^3*kmrgd(3)*exp(-2-1/10*kmrgd(1))^2+2*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(1+exp(-2-1/10*kmrgd(1)))^2*kmrgd(3)*exp(-2-1/10*kmrgd(1)),0,7/10*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/20*kmrgd(1)-5/2)-20*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(1+exp(-2-1/10*kmrgd(1)))^2*exp(-2-1/10*kmrgd(1)),0,0,0,0,0];[-4*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(exp(-7/2-1/10*kmrgd(1))-1)^2*(1-kmrgd(4))*exp(-7/2-1/10*kmrgd(1))+2/5*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*(-35-kmrgd(1))/(exp(-7/2-1/10*kmrgd(1))-1)^3*(1-kmrgd(4))*exp(-7/2-1/10*kmrgd(1))^2-1/5*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*(-35-kmrgd(1))/(exp(-7/2-1/10*kmrgd(1))-1)^2*(1-kmrgd(4))*exp(-7/2-1/10*kmrgd(1))-200/81*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/18*kmrgd(1)-10/3)*kmrgd(4),0,0,20*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(exp(-7/2-1/10*kmrgd(1))-1)-2*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*(-35-kmrgd(1))/(exp(-7/2-1/10*kmrgd(1))-1)^2*exp(-7/2-1/10*kmrgd(1))+400/9*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/18*kmrgd(1)-10/3),0,0,0,0];[7/200*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/20*kmrgd(1)-11/4)*(1-kmrgd(5))-4*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(1+exp(-5/2-1/10*kmrgd(1)))^3*kmrgd(5)*exp(-5/2-1/10*kmrgd(1))^2+2*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(1+exp(-5/2-1/10*kmrgd(1)))^2*kmrgd(5)*exp(-5/2-1/10*kmrgd(1)),0,0,0,7/10*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/20*kmrgd(1)-11/4)-20*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(1+exp(-5/2-1/10*kmrgd(1)))^2*exp(-5/2-1/10*kmrgd(1)),0,0,0];[-2/5*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(exp(-2-1/10*kmrgd(1))-1)^2*(1-kmrgd(6))*exp(-2-1/10*kmrgd(1))+1/25*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*(-20-kmrgd(1))/(exp(-2-1/10*kmrgd(1))-1)^3*(1-kmrgd(6))*exp(-2-1/10*kmrgd(1))^2-1/50*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*(-20-kmrgd(1))/(exp(-2-1/10*kmrgd(1))-1)^2*(1-kmrgd(6))*exp(-2-1/10*kmrgd(1))-1/256*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/80*kmrgd(1)-3/8)*kmrgd(6),0,0,0,0,2*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(exp(-2-1/10*kmrgd(1))-1)-1/5*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*(-20-kmrgd(1))/(exp(-2-1/10*kmrgd(1))-1)^2*exp(-2-1/10*kmrgd(1))+5/16*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/80*kmrgd(1)-3/8),0,0];[0,0,0,0,0,0,0,0];[0,-149760/17177*kmrgd(2)^2*kmrgd(3),-49920/17177*kmrgd(2)^3,0,0,0,0,0]];
hess2=[[-7800*kmrgd(2)^2*kmrgd(3),-15600*kmrgd(2)*kmrgd(3)*(kmrgd(1)-100),-7800*kmrgd(2)^2*(kmrgd(1)-100),0,0,0,0,0];[20*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(exp(-5/2-1/10*kmrgd(1))-1)-2*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*(-25-kmrgd(1))/(exp(-5/2-1/10*kmrgd(1))-1)^2*exp(-5/2-1/10*kmrgd(1))+400/9*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/18*kmrgd(1)-25/9),0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[-149760/17177*kmrgd(2)^2*kmrgd(3),-299520/17177*kmrgd(2)*kmrgd(3)*(kmrgd(1)-100),-149760/17177*kmrgd(2)^2*(kmrgd(1)-100),0,0,0,0,0]];
hess3=[[-2600*kmrgd(2)^3,-7800*kmrgd(2)^2*(kmrgd(1)-100),0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[7/10*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/20*kmrgd(1)-5/2)-20*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(1+exp(-2-1/10*kmrgd(1)))^2*exp(-2-1/10*kmrgd(1)),0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[-49920/17177*kmrgd(2)^3,-149760/17177*kmrgd(2)^2*(kmrgd(1)-100),0,0,0,0,0,0]];
hess4=[[-2340*kmrgd(4)^2*kmrgd(5),0,0,-4680*kmrgd(4)*kmrgd(5)*(kmrgd(1)-60),-2340*kmrgd(4)^2*(kmrgd(1)-60),0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[20*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(exp(-7/2-1/10*kmrgd(1))-1)-2*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*(-35-kmrgd(1))/(exp(-7/2-1/10*kmrgd(1))-1)^2*exp(-7/2-1/10*kmrgd(1))+400/9*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/18*kmrgd(1)-10/3),0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
hess5=[[-780*kmrgd(4)^3,0,0,-2340*kmrgd(4)^2*(kmrgd(1)-60),0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[7/10*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/20*kmrgd(1)-11/4)-20*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(1+exp(-5/2-1/10*kmrgd(1)))^2*exp(-5/2-1/10*kmrgd(1)),0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
hess6=[[-9600*kmrgd(6)^3,0,0,0,0,-28800*kmrgd(6)^2*(kmrgd(1)+75),0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[2*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(exp(-2-1/10*kmrgd(1))-1)-1/5*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*(-20-kmrgd(1))/(exp(-2-1/10*kmrgd(1))-1)^2*exp(-2-1/10*kmrgd(1))+5/16*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/80*kmrgd(1)-3/8),0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
hess7=[[-18,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,-1/100];[0,0,0,0,0,0,0,0]];
hess8=[[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,-1/100,0];[0,0,0,0,0,0,0,0]];
hess(:,:,1) =hess1;
hess(:,:,2) =hess2;
hess(:,:,3) =hess3;
hess(:,:,4) =hess4;
hess(:,:,5) =hess5;
hess(:,:,6) =hess6;
hess(:,:,7) =hess7;
hess(:,:,8) =hess8;
% --------------------------------------------------------------------------
function hessp = hessiansp(t,kmrgd,Cabas, T)
hessp1=[[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,1/100,0];[0,0,0,0,0,0,0,0]];
hessp2=[[0,0,0,0,0,0,0,0];[-2473854946935173/1125899906842624*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(exp(-5/2-1/10*kmrgd(1))-1)*(1-kmrgd(2))+2473854946935173/11258999068426240*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*(-25-kmrgd(1))/(exp(-5/2-1/10*kmrgd(1))-1)^2*(1-kmrgd(2))*exp(-5/2-1/10*kmrgd(1))+12369274734675865/2533274790395904*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/18*kmrgd(1)-25/9)*kmrgd(2),-2473854946935173/1125899906842624*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*(-25-kmrgd(1))/(exp(-5/2-1/10*kmrgd(1))-1)-12369274734675865/140737488355328*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/18*kmrgd(1)-25/9),0,0,0,0,0,0];[-17316984628546211/225179981368524800*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/20*kmrgd(1)-5/2)*(1-kmrgd(3))-2473854946935173/1125899906842624*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(1+exp(-2-1/10*kmrgd(1)))^2*kmrgd(3)*exp(-2-1/10*kmrgd(1)),0,-17316984628546211/11258999068426240*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/20*kmrgd(1)-5/2)-12369274734675865/562949953421312*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(1+exp(-2-1/10*kmrgd(1))),0,0,0,0,0];[-2473854946935173/1125899906842624*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(exp(-7/2-1/10*kmrgd(1))-1)*(1-kmrgd(4))+2473854946935173/11258999068426240*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*(-35-kmrgd(1))/(exp(-7/2-1/10*kmrgd(1))-1)^2*(1-kmrgd(4))*exp(-7/2-1/10*kmrgd(1))+12369274734675865/2533274790395904*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/18*kmrgd(1)-10/3)*kmrgd(4),0,0,-2473854946935173/1125899906842624*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*(-35-kmrgd(1))/(exp(-7/2-1/10*kmrgd(1))-1)-12369274734675865/140737488355328*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/18*kmrgd(1)-10/3),0,0,0,0];[-17316984628546211/225179981368524800*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/20*kmrgd(1)-11/4)*(1-kmrgd(5))-2473854946935173/1125899906842624*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(1+exp(-5/2-1/10*kmrgd(1)))^2*kmrgd(5)*exp(-5/2-1/10*kmrgd(1)),0,0,0,-17316984628546211/11258999068426240*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/20*kmrgd(1)-11/4)-12369274734675865/562949953421312*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(1+exp(-5/2-1/10*kmrgd(1))),0,0,0];[-2473854946935173/11258999068426240*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(exp(-2-1/10*kmrgd(1))-1)*(1-kmrgd(6))+2473854946935173/112589990684262400*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*(-20-kmrgd(1))/(exp(-2-1/10*kmrgd(1))-1)^2*(1-kmrgd(6))*exp(-2-1/10*kmrgd(1))+2473854946935173/72057594037927936*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/80*kmrgd(1)-3/8)*kmrgd(6),0,0,0,0,-2473854946935173/11258999068426240*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*(-20-kmrgd(1))/(exp(-2-1/10*kmrgd(1))-1)-12369274734675865/4503599627370496*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/80*kmrgd(1)-3/8),0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
hessp(:,:,1) =hessp1;
hessp(:,:,2) =hessp2;
%---------------------------------------------------------------------------
function tens3  = der3(t,kmrgd,Cabas, T)
tens31=[[0,0,0,0,0,0,0,0];[-6/5*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(exp(-5/2-1/10*kmrgd(1))-1)^3*(1-kmrgd(2))*exp(-5/2-1/10*kmrgd(1))^2+3/5*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(exp(-5/2-1/10*kmrgd(1))-1)^2*(1-kmrgd(2))*exp(-5/2-1/10*kmrgd(1))+3/25*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*(-25-kmrgd(1))/(exp(-5/2-1/10*kmrgd(1))-1)^4*(1-kmrgd(2))*exp(-5/2-1/10*kmrgd(1))^3-3/25*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*(-25-kmrgd(1))/(exp(-5/2-1/10*kmrgd(1))-1)^3*(1-kmrgd(2))*exp(-5/2-1/10*kmrgd(1))^2+1/50*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*(-25-kmrgd(1))/(exp(-5/2-1/10*kmrgd(1))-1)^2*(1-kmrgd(2))*exp(-5/2-1/10*kmrgd(1))+100/729*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/18*kmrgd(1)-25/9)*kmrgd(2),4*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(exp(-5/2-1/10*kmrgd(1))-1)^2*exp(-5/2-1/10*kmrgd(1))-2/5*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*(-25-kmrgd(1))/(exp(-5/2-1/10*kmrgd(1))-1)^3*exp(-5/2-1/10*kmrgd(1))^2+1/5*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*(-25-kmrgd(1))/(exp(-5/2-1/10*kmrgd(1))-1)^2*exp(-5/2-1/10*kmrgd(1))-200/81*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/18*kmrgd(1)-25/9),0,0,0,0,0,0];[-7/4000*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/20*kmrgd(1)-5/2)*(1-kmrgd(3))-6/5*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(1+exp(-2-1/10*kmrgd(1)))^4*kmrgd(3)*exp(-2-1/10*kmrgd(1))^3+6/5*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(1+exp(-2-1/10*kmrgd(1)))^3*kmrgd(3)*exp(-2-1/10*kmrgd(1))^2-1/5*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(1+exp(-2-1/10*kmrgd(1)))^2*kmrgd(3)*exp(-2-1/10*kmrgd(1)),0,-7/200*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/20*kmrgd(1)-5/2)-4*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(1+exp(-2-1/10*kmrgd(1)))^3*exp(-2-1/10*kmrgd(1))^2+2*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(1+exp(-2-1/10*kmrgd(1)))^2*exp(-2-1/10*kmrgd(1)),0,0,0,0,0];[-6/5*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(exp(-7/2-1/10*kmrgd(1))-1)^3*(1-kmrgd(4))*exp(-7/2-1/10*kmrgd(1))^2+3/5*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(exp(-7/2-1/10*kmrgd(1))-1)^2*(1-kmrgd(4))*exp(-7/2-1/10*kmrgd(1))+3/25*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*(-35-kmrgd(1))/(exp(-7/2-1/10*kmrgd(1))-1)^4*(1-kmrgd(4))*exp(-7/2-1/10*kmrgd(1))^3-3/25*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*(-35-kmrgd(1))/(exp(-7/2-1/10*kmrgd(1))-1)^3*(1-kmrgd(4))*exp(-7/2-1/10*kmrgd(1))^2+1/50*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*(-35-kmrgd(1))/(exp(-7/2-1/10*kmrgd(1))-1)^2*(1-kmrgd(4))*exp(-7/2-1/10*kmrgd(1))+100/729*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/18*kmrgd(1)-10/3)*kmrgd(4),0,0,4*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(exp(-7/2-1/10*kmrgd(1))-1)^2*exp(-7/2-1/10*kmrgd(1))-2/5*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*(-35-kmrgd(1))/(exp(-7/2-1/10*kmrgd(1))-1)^3*exp(-7/2-1/10*kmrgd(1))^2+1/5*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*(-35-kmrgd(1))/(exp(-7/2-1/10*kmrgd(1))-1)^2*exp(-7/2-1/10*kmrgd(1))-200/81*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/18*kmrgd(1)-10/3),0,0,0,0];[-7/4000*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/20*kmrgd(1)-11/4)*(1-kmrgd(5))-6/5*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(1+exp(-5/2-1/10*kmrgd(1)))^4*kmrgd(5)*exp(-5/2-1/10*kmrgd(1))^3+6/5*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(1+exp(-5/2-1/10*kmrgd(1)))^3*kmrgd(5)*exp(-5/2-1/10*kmrgd(1))^2-1/5*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(1+exp(-5/2-1/10*kmrgd(1)))^2*kmrgd(5)*exp(-5/2-1/10*kmrgd(1)),0,0,0,-7/200*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/20*kmrgd(1)-11/4)-4*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(1+exp(-5/2-1/10*kmrgd(1)))^3*exp(-5/2-1/10*kmrgd(1))^2+2*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(1+exp(-5/2-1/10*kmrgd(1)))^2*exp(-5/2-1/10*kmrgd(1)),0,0,0];[-3/25*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(exp(-2-1/10*kmrgd(1))-1)^3*(1-kmrgd(6))*exp(-2-1/10*kmrgd(1))^2+3/50*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(exp(-2-1/10*kmrgd(1))-1)^2*(1-kmrgd(6))*exp(-2-1/10*kmrgd(1))+3/250*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*(-20-kmrgd(1))/(exp(-2-1/10*kmrgd(1))-1)^4*(1-kmrgd(6))*exp(-2-1/10*kmrgd(1))^3-3/250*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*(-20-kmrgd(1))/(exp(-2-1/10*kmrgd(1))-1)^3*(1-kmrgd(6))*exp(-2-1/10*kmrgd(1))^2+1/500*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*(-20-kmrgd(1))/(exp(-2-1/10*kmrgd(1))-1)^2*(1-kmrgd(6))*exp(-2-1/10*kmrgd(1))+1/20480*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/80*kmrgd(1)-3/8)*kmrgd(6),0,0,0,0,2/5*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(exp(-2-1/10*kmrgd(1))-1)^2*exp(-2-1/10*kmrgd(1))-1/25*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*(-20-kmrgd(1))/(exp(-2-1/10*kmrgd(1))-1)^3*exp(-2-1/10*kmrgd(1))^2+1/50*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*(-20-kmrgd(1))/(exp(-2-1/10*kmrgd(1))-1)^2*exp(-2-1/10*kmrgd(1))-1/256*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/80*kmrgd(1)-3/8),0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
tens32=[[0,-15600*kmrgd(2)*kmrgd(3),-7800*kmrgd(2)^2,0,0,0,0,0];[4*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(exp(-5/2-1/10*kmrgd(1))-1)^2*exp(-5/2-1/10*kmrgd(1))-2/5*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*(-25-kmrgd(1))/(exp(-5/2-1/10*kmrgd(1))-1)^3*exp(-5/2-1/10*kmrgd(1))^2+1/5*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*(-25-kmrgd(1))/(exp(-5/2-1/10*kmrgd(1))-1)^2*exp(-5/2-1/10*kmrgd(1))-200/81*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/18*kmrgd(1)-25/9),0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,-299520/17177*kmrgd(2)*kmrgd(3),-149760/17177*kmrgd(2)^2,0,0,0,0,0]];
tens33=[[0,-7800*kmrgd(2)^2,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[-7/200*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/20*kmrgd(1)-5/2)-4*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(1+exp(-2-1/10*kmrgd(1)))^3*exp(-2-1/10*kmrgd(1))^2+2*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(1+exp(-2-1/10*kmrgd(1)))^2*exp(-2-1/10*kmrgd(1)),0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,-149760/17177*kmrgd(2)^2,0,0,0,0,0,0]];
tens34=[[0,0,0,-4680*kmrgd(4)*kmrgd(5),-2340*kmrgd(4)^2,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[4*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(exp(-7/2-1/10*kmrgd(1))-1)^2*exp(-7/2-1/10*kmrgd(1))-2/5*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*(-35-kmrgd(1))/(exp(-7/2-1/10*kmrgd(1))-1)^3*exp(-7/2-1/10*kmrgd(1))^2+1/5*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*(-35-kmrgd(1))/(exp(-7/2-1/10*kmrgd(1))-1)^2*exp(-7/2-1/10*kmrgd(1))-200/81*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/18*kmrgd(1)-10/3),0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
tens35=[[0,0,0,-2340*kmrgd(4)^2,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[-7/200*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/20*kmrgd(1)-11/4)-4*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(1+exp(-5/2-1/10*kmrgd(1)))^3*exp(-5/2-1/10*kmrgd(1))^2+2*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(1+exp(-5/2-1/10*kmrgd(1)))^2*exp(-5/2-1/10*kmrgd(1)),0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
tens36=[[0,0,0,0,0,-28800*kmrgd(6)^2,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[2/5*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(exp(-2-1/10*kmrgd(1))-1)^2*exp(-2-1/10*kmrgd(1))-1/25*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*(-20-kmrgd(1))/(exp(-2-1/10*kmrgd(1))-1)^3*exp(-2-1/10*kmrgd(1))^2+1/50*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*(-20-kmrgd(1))/(exp(-2-1/10*kmrgd(1))-1)^2*exp(-2-1/10*kmrgd(1))-1/256*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/80*kmrgd(1)-3/8),0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
tens37=[[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
tens38=[[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
tens39=[[0,-15600*kmrgd(2)*kmrgd(3),-7800*kmrgd(2)^2,0,0,0,0,0];[4*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(exp(-5/2-1/10*kmrgd(1))-1)^2*exp(-5/2-1/10*kmrgd(1))-2/5*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*(-25-kmrgd(1))/(exp(-5/2-1/10*kmrgd(1))-1)^3*exp(-5/2-1/10*kmrgd(1))^2+1/5*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*(-25-kmrgd(1))/(exp(-5/2-1/10*kmrgd(1))-1)^2*exp(-5/2-1/10*kmrgd(1))-200/81*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/18*kmrgd(1)-25/9),0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,-299520/17177*kmrgd(2)*kmrgd(3),-149760/17177*kmrgd(2)^2,0,0,0,0,0]];
tens310=[[-15600*kmrgd(2)*kmrgd(3),-15600*kmrgd(3)*(kmrgd(1)-100),-15600*kmrgd(2)*(kmrgd(1)-100),0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[-299520/17177*kmrgd(2)*kmrgd(3),-299520/17177*kmrgd(3)*(kmrgd(1)-100),-299520/17177*kmrgd(2)*(kmrgd(1)-100),0,0,0,0,0]];
tens311=[[-7800*kmrgd(2)^2,-15600*kmrgd(2)*(kmrgd(1)-100),0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[-149760/17177*kmrgd(2)^2,-299520/17177*kmrgd(2)*(kmrgd(1)-100),0,0,0,0,0,0]];
tens312=[[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
tens313=[[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
tens314=[[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
tens315=[[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
tens316=[[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
tens317=[[0,-7800*kmrgd(2)^2,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[-7/200*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/20*kmrgd(1)-5/2)-4*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(1+exp(-2-1/10*kmrgd(1)))^3*exp(-2-1/10*kmrgd(1))^2+2*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(1+exp(-2-1/10*kmrgd(1)))^2*exp(-2-1/10*kmrgd(1)),0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,-149760/17177*kmrgd(2)^2,0,0,0,0,0,0]];
tens318=[[-7800*kmrgd(2)^2,-15600*kmrgd(2)*(kmrgd(1)-100),0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[-149760/17177*kmrgd(2)^2,-299520/17177*kmrgd(2)*(kmrgd(1)-100),0,0,0,0,0,0]];
tens319=[[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
tens320=[[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
tens321=[[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
tens322=[[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
tens323=[[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
tens324=[[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
tens325=[[0,0,0,-4680*kmrgd(4)*kmrgd(5),-2340*kmrgd(4)^2,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[4*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(exp(-7/2-1/10*kmrgd(1))-1)^2*exp(-7/2-1/10*kmrgd(1))-2/5*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*(-35-kmrgd(1))/(exp(-7/2-1/10*kmrgd(1))-1)^3*exp(-7/2-1/10*kmrgd(1))^2+1/5*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*(-35-kmrgd(1))/(exp(-7/2-1/10*kmrgd(1))-1)^2*exp(-7/2-1/10*kmrgd(1))-200/81*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/18*kmrgd(1)-10/3),0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
tens326=[[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
tens327=[[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
tens328=[[-4680*kmrgd(4)*kmrgd(5),0,0,-4680*kmrgd(5)*(kmrgd(1)-60),-4680*kmrgd(4)*(kmrgd(1)-60),0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
tens329=[[-2340*kmrgd(4)^2,0,0,-4680*kmrgd(4)*(kmrgd(1)-60),0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
tens330=[[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
tens331=[[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
tens332=[[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
tens333=[[0,0,0,-2340*kmrgd(4)^2,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[-7/200*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/20*kmrgd(1)-11/4)-4*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(1+exp(-5/2-1/10*kmrgd(1)))^3*exp(-5/2-1/10*kmrgd(1))^2+2*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(1+exp(-5/2-1/10*kmrgd(1)))^2*exp(-5/2-1/10*kmrgd(1)),0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
tens334=[[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
tens335=[[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
tens336=[[-2340*kmrgd(4)^2,0,0,-4680*kmrgd(4)*(kmrgd(1)-60),0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
tens337=[[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
tens338=[[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
tens339=[[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
tens340=[[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
tens341=[[0,0,0,0,0,-28800*kmrgd(6)^2,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[2/5*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)/(exp(-2-1/10*kmrgd(1))-1)^2*exp(-2-1/10*kmrgd(1))-1/25*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*(-20-kmrgd(1))/(exp(-2-1/10*kmrgd(1))-1)^3*exp(-2-1/10*kmrgd(1))^2+1/50*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*(-20-kmrgd(1))/(exp(-2-1/10*kmrgd(1))-1)^2*exp(-2-1/10*kmrgd(1))-1/256*exp(2473854946935173/22517998136852480*T-155852861656915899/225179981368524800)*exp(-1/80*kmrgd(1)-3/8),0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
tens342=[[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
tens343=[[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
tens344=[[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
tens345=[[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
tens346=[[-28800*kmrgd(6)^2,0,0,0,0,-57600*kmrgd(6)*(kmrgd(1)+75),0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
tens347=[[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
tens348=[[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
tens349=[[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
tens350=[[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
tens351=[[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
tens352=[[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
tens353=[[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
tens354=[[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
tens355=[[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
tens356=[[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
tens357=[[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
tens358=[[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
tens359=[[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
tens360=[[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
tens361=[[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
tens362=[[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
tens363=[[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
tens364=[[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0];[0,0,0,0,0,0,0,0]];
tens3(:,:,1,1) =tens31;
tens3(:,:,1,2) =tens32;
tens3(:,:,1,3) =tens33;
tens3(:,:,1,4) =tens34;
tens3(:,:,1,5) =tens35;
tens3(:,:,1,6) =tens36;
tens3(:,:,1,7) =tens37;
tens3(:,:,1,8) =tens38;
tens3(:,:,2,1) =tens39;
tens3(:,:,2,2) =tens310;
tens3(:,:,2,3) =tens311;
tens3(:,:,2,4) =tens312;
tens3(:,:,2,5) =tens313;
tens3(:,:,2,6) =tens314;
tens3(:,:,2,7) =tens315;
tens3(:,:,2,8) =tens316;
tens3(:,:,3,1) =tens317;
tens3(:,:,3,2) =tens318;
tens3(:,:,3,3) =tens319;
tens3(:,:,3,4) =tens320;
tens3(:,:,3,5) =tens321;
tens3(:,:,3,6) =tens322;
tens3(:,:,3,7) =tens323;
tens3(:,:,3,8) =tens324;
tens3(:,:,4,1) =tens325;
tens3(:,:,4,2) =tens326;
tens3(:,:,4,3) =tens327;
tens3(:,:,4,4) =tens328;
tens3(:,:,4,5) =tens329;
tens3(:,:,4,6) =tens330;
tens3(:,:,4,7) =tens331;
tens3(:,:,4,8) =tens332;
tens3(:,:,5,1) =tens333;
tens3(:,:,5,2) =tens334;
tens3(:,:,5,3) =tens335;
tens3(:,:,5,4) =tens336;
tens3(:,:,5,5) =tens337;
tens3(:,:,5,6) =tens338;
tens3(:,:,5,7) =tens339;
tens3(:,:,5,8) =tens340;
tens3(:,:,6,1) =tens341;
tens3(:,:,6,2) =tens342;
tens3(:,:,6,3) =tens343;
tens3(:,:,6,4) =tens344;
tens3(:,:,6,5) =tens345;
tens3(:,:,6,6) =tens346;
tens3(:,:,6,7) =tens347;
tens3(:,:,6,8) =tens348;
tens3(:,:,7,1) =tens349;
tens3(:,:,7,2) =tens350;
tens3(:,:,7,3) =tens351;
tens3(:,:,7,4) =tens352;
tens3(:,:,7,5) =tens353;
tens3(:,:,7,6) =tens354;
tens3(:,:,7,7) =tens355;
tens3(:,:,7,8) =tens356;
tens3(:,:,8,1) =tens357;
tens3(:,:,8,2) =tens358;
tens3(:,:,8,3) =tens359;
tens3(:,:,8,4) =tens360;
tens3(:,:,8,5) =tens361;
tens3(:,:,8,6) =tens362;
tens3(:,:,8,7) =tens363;
tens3(:,:,8,8) =tens364;
%---------------------------------------------------------------------------
function tens4  = der4(t,kmrgd,Cabas, T)
%---------------------------------------------------------------------------
function tens5  = der5(t,kmrgd,Cabas, T)
